package org.hales.pojo;

import cn.hutool.core.annotation.Alias;
import lombok.Data;
import org.hales.annotation.ExcelReadFieldName;

/**
 * 加油站信息
 * @author 陈建康
 */
@Data
public class PetrolStation {
    @ExcelReadFieldName("加油站名称")
    @Alias("加油站名称")
    private String stationName;
    @Alias("机构信用代码")
    @ExcelReadFieldName("机构信用代码")
    private String creditCode;
    @ExcelReadFieldName("MN号")
    @Alias("MN号")
    private String mnCode;
    @ExcelReadFieldName("经营地址")
    @Alias("经营地址")
    private String address;
    @ExcelReadFieldName("经度")
    @Alias("经度")
    private String longitude;
    @Alias("纬度")
    @ExcelReadFieldName("纬度")
    private String latitude;
    @ExcelReadFieldName("区县")
    private String county;
    @ExcelReadFieldName("品牌和型号")
    private String model;

    public void setLongitude(String longitude) {
        if(longitude != null && longitude.contains("°")){
            this.longitude = longitude.split("°")[0];
        }
    }

    public void setLatitude(String latitude) {
        if(latitude != null && latitude.contains("°")){
            this.latitude = latitude.split("°")[0];
        }
    }

    public void setModel(String model) {
        if(model != null){
            this.model = model.replace("\n", "");
        }
    }
}
